package cn.alise.qdp.service.log;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import cn.alise.qdp.mapper.log.UserAccessLogsMapper;
import cn.alise.qdp.model.log.UserAccessLogs;

@Service
@Transactional(rollbackFor = Exception.class)
public class UserAccessLogsService {

	@Resource(name = "userAccessLogsMapper")
	private UserAccessLogsMapper userAccessLogsMapper;
	
	public UserAccessLogs get(UserAccessLogs args) {
		List<UserAccessLogs> list = this.list(args);
		if (!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}
		
		return null;
	}
	
	public List<UserAccessLogs> gets(Map<String, Object> args){
		return this.userAccessLogsMapper.gets(args);
	}
	
	public List<UserAccessLogs> list(UserAccessLogs args) {
		return this.userAccessLogsMapper.list(args);
	}
	
	public List<UserAccessLogs> page(Map<String, Object> args) {
		return this.userAccessLogsMapper.page(args);
	}
	
	public int delete(UserAccessLogs args) {
		return this.userAccessLogsMapper.delete(args);
	}
	
	public int save(UserAccessLogs args) {
		return this.userAccessLogsMapper.insert(args);
	}
	
	public int update(UserAccessLogs  args) {
		return this.userAccessLogsMapper.update(args);
	}
	public int total(UserAccessLogs args){
		return this.userAccessLogsMapper.total(args);
	}
	
	/**
	 * 删除日志数据
	 */
	public int deleteByClearTime(UserAccessLogs record) {
		return this.userAccessLogsMapper.deleteByClearTime(record);
	}
}
